<template>
  <div class="app-container">
    <el-dialog
      ref="fireDialoag"
      :title="dialogTitle"
      :visible.sync="open"
      class="open-container"
      @closed="closeDialog"
      :modal-append-to-body="false"
    >
      <el-form
        ref="fireForm"
        :rules="rules"
        :model="form"
        label-position="right"
        label-width="126px"
        class="dialogForm"
      >
        <table>
          <caption class="title">
            煤田火区基本情况信息表
          </caption>

          <thead>
            <tr>
              <el-form-item label="火区名称" prop="fireName">
                <th colspan="6" class="value th_label">
                  <el-input
                    class="elInput"
                    :readonly="type == 'detail'"
                    v-model="form.fireName"
                  ></el-input>
                </th>
              </el-form-item>
            </tr>
          </thead>
          <tbody>
            <tr>
              <el-form-item label="所属管辖" prop="jurisdiction">
                <td colspan="7" class="value td_label">
                  <el-input
                    class="elInput"
                    :readonly="type == 'detail'"
                    v-model="form.jurisdiction"
                  ></el-input>
                </td>
              </el-form-item>
            </tr>
            <tr>
              <el-form-item label="火区治理状态" prop="ifGovernance">
                <td colspan="6" class="value td_label">
                  <el-select
                    class="select"
                    placeholder=""
                    v-model="form.ifGovernance"
                    :disabled="type == 'detail'"
                    style="100%"
                  >
                    <el-option
                      v-for="(li, j) in ifGovernance"
                      :key="j"
                      :label="li.value"
                      :value="li.id"
                    ></el-option>
                  </el-select>
                </td>
              </el-form-item>
            </tr>
            <tr>
              <el-form-item label="火区阶段统计" prop="statisticalStage">
                <td colspan="6" class="value td_label">
                  <el-select
                    placeholder=""
                    class="select"
                    v-model="form.statisticalStage"
                    :disabled="type == 'detail'"
                    style="100%"
                  >
                    <el-option
                      v-for="(li, j) in statisticalStage"
                      :key="j"
                      :label="li.value"
                      :value="li.id"
                    ></el-option>
                  </el-select>
                </td>
              </el-form-item>
            </tr>
            <tr>
              <el-form-item label="火区类型统计" prop="type">
                <td colspan="6" class="value td_label">
                  <el-select
                    placeholder=""
                    class="select"
                    v-model="form.type"
                    :disabled="type == 'detail'"
                    clearable
                    style="100%"
                  >
                    <el-option
                      v-for="(li, j) in typeS"
                      :key="j"
                      :label="li.value"
                      :value="li.id"
                    ></el-option>
                  </el-select>
                </td>
              </el-form-item>
            </tr>

            <tr>
              <el-form-item label="火区经度" prop="longitude">
                <td colspan="7" class="value td_label">
                  <el-input
                    placeholder="请输入火区经度"
                    class="elInput"
                    v-model="form.longitude"
                    :readonly="type == 'detail'"
                  ></el-input>
                </td>
              </el-form-item>
            </tr>
            <tr>
              <el-form-item label="火区纬度" prop="latitude">
                <td colspan="7" class="value td_label">
                  <el-input
                    placeholder="请输入火区纬度"
                    class="elInput"
                    v-model="form.latitude"
                    :readonly="type == 'detail'"
                  ></el-input>
                </td>
              </el-form-item>
            </tr>
            <!-- 火区普查阶段 -->
            <tr>
              <td class="label" colspan="7">火区普查阶段</td>
            </tr>
            <tr>
              <td class="label">火区面积</td>
              <td class="value" colspan="3">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="form.fireArea"
                ></el-input>
              </td>
              <td class="label">火区内煤层</td>
              <td class="value" colspan="3">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="form.coalSeams"
                ></el-input>
              </td>
            </tr>
            <tr>
              <td class="label">煤层厚度</td>
              <td class="value" colspan="3">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="form.coalThickness"
                ></el-input>
              </td>
              <td class="label">煤层倾角</td>
              <td class="value" colspan="3">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="form.coalAngle"
                ></el-input>
              </td>
            </tr>
            <tr>
              <td class="label">燃烧煤层</td>
              <td class="value" colspan="3">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="form.coalBurning"
                ></el-input>
              </td>
              <td class="label">燃烧深度</td>
              <td class="value" colspan="3">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="form.burningDepth"
                ></el-input>
              </td>
            </tr>
            <tr>
              <td class="label">矿业权情况</td>
              <td class="value" colspan="3">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="form.miningSituation"
                ></el-input>
              </td>
              <td class="label">坐标系</td>
              <td class="value" colspan="3">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="form.coordinateSystem"
                ></el-input>
              </td>
            </tr>
            <tr>
              <td class="label threeHeight">火区拐点坐标</td>
              <td colspan="6" class="value threeHeight">
                <el-input
                  :rows="6"
                  :readonly="type == 'detail'"
                  type="textarea"
                  v-model="form.inflectionPoints"
                ></el-input>
              </td>
            </tr>
            <tr>
              <td class="label twoHeight">附件及附图</td>
              <td colspan="6" class="value twoHeight fujian">
                <fileUpload
                  :isShow="type != 'detail'"
                  :fileType="fileType"
                  :fileSize="1024"
                  v-model="form.rattachment"
                />
              </td>
            </tr>
            <!-- 火区详细勘查阶段 -->
            <tr>
              <td class="label" colspan="7">火区详细勘查阶段</td>
            </tr>
            <tr>
              <td class="label">火区面积</td>
              <td class="value" colspan="3">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="form.rfireArea"
                ></el-input>
              </td>
              <td class="label">火区内煤层</td>
              <td class="value" colspan="3">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="form.rcoalSeams"
                ></el-input>
              </td>
            </tr>
            <tr>
              <td class="label">煤层厚度</td>
              <td class="value" colspan="3">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="form.rCoalThickness"
                ></el-input>
              </td>
              <td class="label">煤层倾角</td>
              <td class="value" colspan="3">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="form.rcoalAngle"
                ></el-input>
              </td>
            </tr>
            <tr>
              <td class="label">燃烧煤层</td>
              <td class="value" colspan="3">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="form.rcoalBurning"
                ></el-input>
              </td>
              <td class="label">燃烧深度</td>
              <td class="value" colspan="3">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="form.rburningDepth"
                ></el-input>
              </td>
            </tr>
            <tr>
              <td class="label">详细勘查单位</td>
              <td class="value" colspan="3">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="form.explorationUnit"
                ></el-input>
              </td>
              <td class="label">详细勘查时间</td>
              <td class="value" colspan="3">
                <el-input v-model="form.explorationTime"></el-input>
                <!-- <el-date-picker
                  :readonly="type == 'detail'"
                  style="width: 238px"
                  v-model="form.explorationTime"
                  value-format="yyyy-MM-dd HH:mm:ss"
                  type="date"
                  placeholder="选择日期"
                >
                </el-date-picker> -->
              </td>
            </tr>
            <tr>
              <td class="label">详勘批复时间</td>
              <td class="value" colspan="3">
                <el-input v-model="form.approvalTime"></el-input>
                <!-- <el-date-picker
                  style="width: 424px"
                  :readonly="type == 'detail'"
                  value-format="yyyy-MM-dd HH:mm:ss"
                  v-model="form.approvalTime"
                  type="date"
                  placeholder="选择日期"
                >
                </el-date-picker> -->
              </td>
              <td class="label">批复单位</td>
              <td class="value" colspan="3">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="form.approvedUnit"
                ></el-input>
              </td>
            </tr>
            <tr>
              <td class="label">矿业权情况</td>
              <td class="value" colspan="3">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="form.rminingSituation"
                ></el-input>
              </td>
              <td class="label">坐标系</td>
              <td class="value" colspan="3">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="form.rcoordinateSystem"
                ></el-input>
              </td>
            </tr>
            <tr>
              <td class="label threeHeight">火区拐点坐标</td>
              <td colspan="6" class="value threeHeight">
                <el-input
                  :readonly="type == 'detail'"
                  :rows="6"
                  type="textarea"
                  v-model="form.rinflectionPoints"
                ></el-input>
              </td>
            </tr>
            <tr>
              <td class="label twoHeight">附件</td>
              <td colspan="6" class="value twoHeight fujian">
                <!-- 1、火区详细勘查报告 2、火区详细勘查批复 3、详细勘查图纸
              4、详细勘查阶段影音资料 -->
                <fileUpload
                  :isShow="type != 'detail'"
                  :fileType="fileType"
                  :fileSize="1024"
                  v-model="form.explorationAttachment"
                />
              </td>
            </tr>
            <!-- 火区初步设计阶段 -->
            <tr>
              <td class="label" colspan="7">火区初步设计阶段</td>
            </tr>
            <tr>
              <td class="label">设计单位</td>
              <td class="value" colspan="3">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="form.designUnit"
                ></el-input>
              </td>
              <td class="label">项目概算</td>
              <td class="value" colspan="3">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="form.projectEstimate"
                ></el-input>
              </td>
            </tr>
            <tr>
              <td class="label">治理方法</td>
              <td class="value" colspan="3">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="form.governanceMethods"
                ></el-input>
              </td>
              <td class="label">治理面积</td>
              <td class="value" colspan="3">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="form.governanceArea"
                ></el-input>
              </td>
            </tr>
            <tr>
              <td class="label" rowspan="2">设计工程量</td>
              <td class="label">剥离：</td>
              <td class="value">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="form.designQuantityStripping"
                ></el-input>
              </td>
              <td class="label">钻探：</td>
              <td class="value">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="form.designQuantityDrilling"
                ></el-input>
              </td>
              <td class="label">注水：</td>
              <td class="value">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="form.designQuantityWaterInjection"
                ></el-input>
              </td>
            </tr>
            <tr>
              <td class="label">注浆：</td>
              <td class="value">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="form.designQuantityGrouting"
                ></el-input>
              </td>
              <td class="label">覆盖：</td>
              <td class="value">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="form.designQuantityCoverage"
                ></el-input>
              </td>
              <td class="label">植被恢复</td>
              <td class="value">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="form.designQuantityVegetationRestoration"
                ></el-input>
              </td>
            </tr>
            <tr>
              <td class="label">设计批复时间</td>
              <td class="value" colspan="3">
                <el-input v-model="form.designApprovalTime"></el-input>
                <!-- <el-date-picker
                  style="width: 424px"
                  v-model="form.designApprovalTime"
                  value-format="yyyy-MM-dd hh:mm:ss"
                  type="date"
                  :readonly="type == 'detail'"
                  placeholder="选择日期"
                >
                </el-date-picker> -->
              </td>

              <td class="label">批复单位</td>
              <td class="value" colspan="3">
                <el-input
                  v-model="form.approvalUnit"
                  :readonly="type == 'detail'"
                ></el-input>
              </td>
            </tr>
            <tr>
              <td class="label twoHeight">附件</td>
              <td colspan="6" class="value threeHeight fujian">
                <!-- 1、火区初步设计报告 2、初步设计图纸； 3、设计批复 4、其他资料 -->
                <fileUpload
                  :isShow="type != 'detail'"
                  :fileType="fileType"
                  :fileSize="1024"
                  v-model="form.preliminaryAttachment"
                />
              </td>
            </tr>
            <!-- 火区治理阶段 -->
            <tr>
              <td class="label" colspan="7">火区治理阶段</td>
            </tr>
            <tr>
              <td class="label">施工单位</td>
              <td class="value" colspan="3">
                <el-input
                  v-model="form.constructionUnit"
                  :readonly="type == 'detail'"
                ></el-input>
              </td>
              <td class="label">治理时间</td>
              <td class="value" colspan="3">
                <el-input v-model="form.governanceTime"></el-input>
                <!-- <el-date-picker
                  style="width: 238px"
                  value-format="yyyy-MM-dd hh:mm:ss"
                  v-model="form.governanceTime"
                  type="date"
                  :readonly="type == 'detail'"
                  placeholder="选择日期"
                >
                </el-date-picker> -->
              </td>
            </tr>
            <tr>
              <td class="label" rowspan="2">实际完成工程量</td>
              <td class="label">剥离：</td>
              <td class="value">
                <el-input
                  v-model="form.actualQuantityStripping"
                  :readonly="type == 'detail'"
                ></el-input>
              </td>
              <td class="label">钻探：</td>
              <td class="value">
                <el-input
                  v-model="form.actualQuantityDrilling"
                  :readonly="type == 'detail'"
                ></el-input>
              </td>
              <td class="label">注水：</td>
              <td class="value">
                <el-input
                  v-model="form.actualQuantityWaterInjection"
                  :readonly="type == 'detail'"
                ></el-input>
              </td>
            </tr>
            <tr>
              <td class="label">注浆：</td>
              <td class="value">
                <el-input
                  v-model="form.actualQuantityGrouting"
                  :readonly="type == 'detail'"
                ></el-input>
              </td>
              <td class="label">覆盖：</td>
              <td class="value">
                <el-input
                  v-model="form.actualQuantityCoverage"
                  :readonly="type == 'detail'"
                ></el-input>
              </td>
              <td class="label">植被恢复</td>
              <td class="value">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="form.actualQuantityVegetationRestoration"
                ></el-input>
              </td>
            </tr>
            <tr>
              <td class="label">竣工验收时间</td>
              <td class="value" colspan="2">
                <el-input v-model="form.acceptanceTime"></el-input>
                <!-- <el-date-picker
                  style="width: 300px"
                  :readonly="type == 'detail'"
                  value-format="yyyy-MM-dd hh:mm:ss"
                  v-model="form.acceptanceTime"
                  type="date"
                  placeholder="选择日期"
                >
                </el-date-picker> -->
              </td>
              <td class="label">监理单位</td>
              <td class="value" colspan="4">
                <el-input
                  v-model="form.controlUnit"
                  :readonly="type == 'detail'"
                ></el-input>
              </td>
            </tr>
            <tr>
              <td class="label twoHeight">附件</td>
              <td colspan="6" class="value threeHeight fujian">
                <!-- <el-input :rows="6" type="textarea" v-model="form.textArea4">
              </el-input
              > -->
                <!-- 1、竣工报告  </br>2、验收报告  </br>3、竣工图纸 </br> 4、其他资料 -->
                <fileUpload
                  :isShow="type != 'detail'"
                  :fileType="fileType"
                  :fileSize="1024"
                  v-model="form.administerAttachment"
                />
              </td>
            </tr>
          </tbody>
        </table>
      </el-form>
      <div slot="footer" class="dialog-footer" v-show="type != 'detail'">
        <el-button
          type="primary"
          size="small"
          style="width: 108px"
          @click="submitHandler"
          >保 存</el-button
        >
        <el-button @click="cancel" size="small" style="width: 108px"
          >取 消</el-button
        >
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { addFire, updatefire } from "@/api/data/houtai";

export default {
  name: "FireDialoag",
  props: {
    dialogTitle: {
      type: String,
    },
    serviceRefresh: { type: Function, default: () => {} },
  },

  data() {
    return {
      rules: {
        fireName: [
          { required: true, message: "请输入火区名称", trigger: "blur" },
        ],
        jurisdiction: [
          { required: true, message: "请输入所属管辖", trigger: "blur" },
        ],
        ifGovernance: [
          { required: true, message: "请输入火区治理状态", trigger: "blur" },
        ],
        statisticalStage: [
          { required: true, message: "请输入火区阶段统计", trigger: "blur" },
        ],
        type: [
          { required: true, message: "请输入火区类型统计", trigger: "blur" },
        ],
        longitude: [
          { required: true, message: "请输入火区经度", trigger: "blur" },
        ],
        latitude: [
          { required: true, message: "请输入火区纬度", trigger: "blur" },
        ],
      },
      form: {
        type: "",
        firejwd: "",
        ifGovernance: "",
        statisticalStage: "",

        id: undefined,
        jurisdiction: "", //所属管辖
        fireName: "", //	火区名称
        fireArea: "",
        coalSeams: "",
        coalThickness: "",
        coalAngle: "",
        coalBurning: "",
        burningDepth: "",
        miningSituation: "",
        coordinateSystem: "",
        inflectionPoints: "",

        governanceMethods: "",
        governanceArea: "",
        governanceTime: "",
        actualQuantityStripping: "",
        actualQuantityDrilling: "",
        actualQuantityWaterInjection: "",
        actualQuantityGrouting: "",
        actualQuantityVegetationRestoration: "",
        actualQuantityCoverage: "",
        acceptanceTime: "",
        controlUnit: "",
        approvedUnit: "",
        approvalTime: "",
        explorationTime: "",
        explorationUnit: "",
        rcoalSeams: "",
        rcoalSeams: "",
        rcoalBurning: "",
        rcoalAngle: "",
        rminingSituation: "",
        rcoordinateSystem: "",
        rinflectionPoints: "",
        designUnit: "",
        projectEstimate: "",

        designApprovalTime: "",
        designQuantityCoverage: "",
        designQuantityDrilling: "",
        designQuantityGrouting: "",
        designQuantityStripping: "",
        designQuantityVegetationRestoration: "",
        designQuantityWaterInjection: "",
        designUnit: "",
        attachment: "",
        explorationAttachment: "",
        rCoalThickness: "",
        rfireArea: "",
        fireArea: "",
        rburningDepth: "",
        latitude: null,
        longitude: null,
      },
      open: false,
      // 火区治理状态（已治理、治理中、未治理）
      ifGovernance: [
        { id: 1, value: "已治理" },
        { id: 2, value: "治理中" },
        { id: 3, value: "未治理" },
      ],
      // 火区阶段统计（普查、勘查、设计、治理）
      statisticalStage: [
        { id: 1, value: "普查" },
        { id: 2, value: "勘查" },
        { id: 3, value: "设计" },
        { id: 4, value: "治理" },
      ],
      // 火区类型统计（重点火区、一般火区）
      typeS: [
        { id: 1, value: "重点火区" },
        { id: 2, value: "一般火区" },
      ],
      type: "",
      // 文件类型, 例如['png', 'jpg', 'jpeg']
      fileType: ["doc", "xls", "ppt", "txt", "pdf", "png", "jpg", "jpeg"],
    };
  },
  methods: {
    resetData() {
      this.form = {
        type: "",
        firejwd: "",
        ifGovernance: "",
        statisticalStage: "",
        id: undefined,
        jurisdiction: "", //所属管辖
        fireName: "", //	火区名称
        fireArea: "",
        coalSeams: "",
        coalThickness: "",
        coalAngle: "",
        coalBurning: "",
        burningDepth: "",
        miningSituation: "",
        coordinateSystem: "",
        inflectionPoints: "",
        rfireArea: "",
        fireArea: "",
        governanceMethods: "",
        governanceArea: "",
        governanceTime: "",
        actualQuantityStripping: "",
        actualQuantityDrilling: "",
        actualQuantityWaterInjection: "",
        actualQuantityGrouting: "",
        actualQuantityVegetationRestoration: "",
        actualQuantityCoverage: "",
        acceptanceTime: "",
        controlUnit: "",
        approvedUnit: "",
        approvalTime: "",
        explorationTime: "",
        explorationUnit: "",
        rcoalSeams: "",
        rcoalSeams: "",
        rcoalBurning: "",
        rcoalAngle: "",
        rminingSituation: "",
        rcoordinateSystem: "",
        rinflectionPoints: "",
        designUnit: "",
        projectEstimate: "",

        designApprovalTime: "",
        designQuantityCoverage: "",
        designQuantityDrilling: "",
        designQuantityGrouting: "",
        designQuantityStripping: "",
        designQuantityVegetationRestoration: "",
        designQuantityWaterInjection: "",
        designUnit: "",
        attachment: "",
        explorationAttachment: "",
        rCoalThickness: "",
        rburningDepth: "",
        latitude: null,
        longitude: null,
      };
      // this.$nextTick(() => {
      //   this.$refs["fireForm"].clearValidate();
      // });
      this.type = "";
    },
    openDialog(type, row) {
      this.open = true;
      this.resetData();
      this.type = type;
      if (this.type != "create") this.form = Object.assign({}, row);

      if (this.type != "detail") {
        this.rules = {
          fireName: [
            { required: true, message: "请输入火区名称", trigger: "blur" },
          ],
          jurisdiction: [
            { required: true, message: "请输入所属管辖", trigger: "blur" },
          ],
          ifGovernance: [
            { required: true, message: "请输入火区治理状态", trigger: "blur" },
          ],
          statisticalStage: [
            { required: true, message: "请输入火区阶段统计", trigger: "blur" },
          ],
          type: [
            { required: true, message: "请输入火区类型统计", trigger: "blur" },
          ],
        longitude: [
          { required: true, message: "请输入火区经度", trigger: "blur" },
        ],
        latitude: [
          { required: true, message: "请输入火区纬度", trigger: "blur" },
        ],
        };
      } else {
        this.rules = null;
      }
    },
    closeDialog() {
      this.open = false;
      this.resetData();
    },

    valadateData() {
      if (
        (this.form.fireArea && isNaN(Number(this.form.fireArea))) ||
        (this.form.rfireArea && isNaN(Number(this.form.rfireArea)))
      ) {
        this.$modal.msgError("火区面积必须为数字");
        return false;
      }
      if (
        (this.form.coalThickness && isNaN(Number(this.form.coalThickness))) ||
        (this.form.rCoalThickness && isNaN(Number(this.form.rCoalThickness)))
      ) {
        this.$modal.msgError("煤层厚度必须为数字");
        return false;
      }
      if (
        (this.form.coalAngle && isNaN(Number(this.form.coalAngle))) ||
        (this.form.rcoalAngle && isNaN(Number(this.form.rcoalAngle)))
      ) {
        this.$modal.msgError("煤层倾角必须为数字");
        return false;
      }
      if (
        (this.form.burningDepth && isNaN(Number(this.form.burningDepth))) ||
        (this.form.rburningDepth && isNaN(Number(this.form.rburningDepth)))
      ) {
        this.$modal.msgError("燃烧深度必须为数字");
        return false;
      }
      if (
        this.form.projectEstimate &&
        isNaN(Number(this.form.projectEstimate))
      ) {
        this.$modal.msgError("项目概算必须为数字");
        return false;
      }
      if (
        this.form.projectEstimate &&
        isNaN(Number(this.form.projectEstimate))
      ) {
        this.$modal.msgError("项目概算必须为数字");
        return false;
      }
      if (this.form.governanceArea && isNaN(Number(this.form.governanceArea))) {
        this.$modal.msgError("治理面积必须为数字");
        return false;
      }

      if (
        (this.form.designQuantityStripping &&
          isNaN(Number(this.form.designQuantityStripping))) ||
        (this.form.actualQuantityStripping &&
          isNaN(Number(this.form.actualQuantityStripping)))
      ) {
        this.$modal.msgError("剥离必须为数字");
        return false;
      }
      if (
        (this.form.designQuantityDrilling &&
          isNaN(Number(this.form.designQuantityDrilling))) ||
        (this.form.actualQuantityDrilling &&
          isNaN(Number(this.form.actualQuantityDrilling)))
      ) {
        this.$modal.msgError("钻探必须为数字");
        return false;
      }
      if (
        (this.form.designQuantityWaterInjection &&
          isNaN(Number(this.form.designQuantityWaterInjection))) ||
        (this.form.actualQuantityWaterInjection &&
          isNaN(Number(this.form.actualQuantityWaterInjection)))
      ) {
        this.$modal.msgError("注水必须为数字");
        return false;
      }
      if (
        (this.form.designQuantityGrouting &&
          isNaN(Number(this.form.designQuantityGrouting))) ||
        (this.form.actualQuantityGrouting &&
          isNaN(Number(this.form.actualQuantityGrouting)))
      ) {
        this.$modal.msgError("注浆必须为数字");
        return false;
      }
      if (
        (this.form.designQuantityCoverage &&
          isNaN(Number(this.form.designQuantityCoverage))) ||
        (this.form.actualQuantityCoverage &&
          isNaN(Number(this.form.actualQuantityCoverage)))
      ) {
        this.$modal.msgError("覆盖必须为数字");
        return false;
      }
      if (
        (this.form.designQuantityVegetationRestoration &&
          isNaN(Number(this.form.designQuantityVegetationRestoration))) ||
        (this.form.actualQuantityVegetationRestoration &&
          isNaN(Number(this.form.actualQuantityVegetationRestoration)))
      ) {
        this.$modal.msgError("植被恢复必须为数字");
        return false;
      }
      return true;
    },
    //弹框提交处理
    submitHandler() {
      
      this.$refs["fireForm"].validate((valid) => {
        if (valid) {
          if (this.valadateData()) {
            // item.longitude.toFixed(3) + "," + item.latitude.toFixed(3);

            if (this.type === "edit") {
              // 编辑
              updatefire(this.form).then(() => {
                //刷新列表
                this.serviceRefresh();
                //关闭弹框
                this.closeDialog();
                this.$modal.msgSuccess("修改成功");
              });
            } else if (this.type === "create") {
              //创建
              addFire(this.form).then(() => {
                //刷新列表
                this.serviceRefresh();
                //关闭弹框
                this.closeDialog();
                this.$modal.msgSuccess("新增成功");
              });
            }
          }
        }
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
    },
  },
};
</script>
<style lang="scss" scoped>
table {
  width: 100%;
  // border: 1px solid;
  margin-top: -62px;
  border-collapse: collapse;
  .title {
    font-size: 30px;
    margin: 20px;
  }
  th {
    width: 120px;
    height: 35px;
    text-align: center;
    font-size: 15px;
    border: 1px solid;
  }
  td {
    width: 120px;
    height: 35px;
    text-align: center;
    font-size: 15px;
    border: 1px solid;
  }
  .label {
    font-family: "AlibabaPuHuiTi-2-85-Bold";
    font-size: 16px;
    font-weight: normal;
    font-stretch: normal;
    letter-spacing: 1px;
  }
  .value {
    font-family: "AlibabaPuHuiTi-2-55-Regular";
    font-size: 14px;
    font-weight: normal;
    font-stretch: normal;
    letter-spacing: 1px;
  }
  .threeHeight {
    height: 105px;
  }
  .twoHeight {
    height: 70px;
  }
  .fujian {
    font-family: "AlibabaPuHuiTi-2-85-Bold";
    font-size: 16px;
    // display: flex;
    // justify-content: flex-start;
    // flex-direction: column;
  }
  .elInput {
    position: absolute;
    left: 0;
    top: 0;
  }
  .th_label,
  .td_label {
    position: absolute;
    left: 1px;
    width: 783px;
    top: -1px;
    height: 37px;
    border-bottom: 0px;
    border-left: 0;
  }
  .select {
    width: 780px;
    position: absolute;
    top: 0;
    left: 1px;
  }
}

.dialog-footer {
  position: fixed;
  bottom: 0;
  width: 100%;
  height: 66px;
  background: #e5e5e5;
  left: 0;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding-right: 200px;
}
::v-deep .el-dialog:not(.is-fullscreen) {
  margin-top: 80px !important;
  z-index: 1000007 !important;
}

::v-deep .el-form-item {
  margin-bottom: 0;
  border-left: 1px solid;
  border-top: 1px solid;
  border-right: 1px solid;
  ::v-deep .el-form-item__content {
    margin-left: 110px;
  }

  ::v-deep .el-input__inner {
    height: 34px;
    line-height: 34px;
  }
}
::v-deep .el-form-item__label {
  border-bottom: 0px;
  font-family: "AlibabaPuHuiTi-2-85-Bold";
  font-size: 16px;
  font-weight: normal;
  font-stretch: normal;
  letter-spacing: 1px;
  text-align: center;
}
::v-deep .el-form-item__error {
  color: #ff4949;
  font-size: 14px;
  position: absolute;
  top: 100%;
  left: 20px;
  width: 160px;
  z-index: 1;
  display: none;
}
</style>
